<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function show_uname(){
				uname_msg.innerHTML="用户名6-12位";
			}
			function check_uname(){
				//非空验证
				//格式验证
				var _uname=uname.value;
				if(!_uname){
					uname_msg.innerHTML="用户名不能为空";
				}else if(_uname.length<6 || _uname.length>12){
					uname_msg.innerHTML="格式不正确";
				}else{
					uname_msg.innerHTML="√";
				}
			}
		</script>
	</head>
	<body>
		<input onfocus="show_uname()" onblur="check_uname()" id="uname" type="text" placeholder="请输入用户名">
		<span id="uname_msg"></span>
	</body>
</html>
